<template>
	<view class="friends_contents">
		<FriendTopBar @currentSelectPageId="getCurrentPageId" />
		<component :is="currentComponent"></component>
	</view>
</template>
<script>
	import Chat from '@/pages/friendsChat/chatPage/chat.vue';
	import CommunityGroup from '@/pages/friendsChat/communityGroupPage/community.vue';
	// import TelList from '@/pages/friendsChat/telListPage/telList.vue';
	import FriendTopBar from '@/components/friendPageTopBar.vue';
	import { checkIsLogin } from '@/common/util';
	export default {
		components: {
			FriendTopBar,
			Chat,
			CommunityGroup,
			// TelList
		},
		data() {
			return {
				currentComponent: 'Chat',
			}
		},
		onShow() {
			// 判断是否登录，如果没有登录直接跳转登录页面
			checkIsLogin();
		},
		methods: {
			getCurrentPageId(id) {
				// console.log(id);
				if (id === 1) {
					this.currentComponent = 'Chat';
				} else if (id === 2) {
					this.currentComponent = 'CommunityGroup';
				}
				// else{
				// 	this.currentComponent = 'TelList';
				// }
			},
		}
	};
</script>

<style lang="scss" scoped>
</style>